package com.qh.resourcehub.program.qzt.task;

import com.qh.resourcehub.program.qzt.service.QztTodoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class QztTodoSyncTask {

    private static final Logger logger = LoggerFactory.getLogger(QztTodoSyncTask.class);

    @Autowired
    private QztTodoService qztTodoService;

//    @Scheduled(cron = "${qzt.sync.cron:0 0/2 * * * ?}")
    public void syncTodosToQzt() {
        logger.info("定时任务开始: 同步待办到气政通");
        try {
            qztTodoService.syncAllTodosToQzt();
        } catch (Exception e) {
            logger.error("定时任务执行失败: 同步待办到气政通", e);
        }
        logger.info("定时任务结束: 同步待办到气政通");
    }
}
